/*-------------------------------------
		sPlugin
	    By Scooby, 2010
-------------------------------------*/

local PLUGIN = {}

PLUGIN.Name = "Remove Group"
PLUGIN.Author = "Scooby"
PLUGIN.Command = "removegroup"
PLUGIN.Group = 0
PLUGIN.Category = "Group"
PLUGIN.Use = "<Group>"
PLUGIN.Format = "string"
PLUGIN.Menu = { 
	{ 
		["#title"] = "Select Group", 
		["#cont"] = "#groups", 
		["#apos"] = 1 
	} 
}

function PLUGIN:Main( ply, args )
	
	PrintTable( args )
	
	if( !args ) then return end

	local nm = ""
	if not spl:GroupExists( tostring( args[1] ) ) then
		spl:PrintC( ply, spl.red, "Group Not Found!" )
	else
		
		for k,v in pairs( spl.groups ) do
			if( string.lower( v[ "Name" ] ) == string.lower( args[1] ) ) then
				nm = v[ "Name" ]
				table.remove( spl.groups, k )
			end
		end
		
		spl:PrintC( ply, spl.red, "Group '"..nm.."' Removed!" )
		
	end
end

spl:AddPlugin( PLUGIN )